﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Qu.SeniorProject.Model
{
    public class ProjectSummary
    {
        private IList<ProjectDocument> _ProjectDocuments;
        public int ProjectID { get; set; }
        public string Title { get; set; }
        public string Abstract { get; set; }
        public string Students { get; set; }
        public string Major { get; set; }
        public string Gender { get; set; }
        public string Supervisors { get; set; }
        public string ProposalExaminer { get; set; }
        public string Examiners { get; set; }
        public string ProjectYear { get; set; }
        public string HtmlAction { get; set; }
        public string ProjectTasks { get; set; }
        public string SkillsRequired { get; set; }
        public string ResourcesNeeded { get; set; }
        public string Role { get; set; }
        public string PresentationTime { get; set; }
        //public string FinalPresentationTime { get; set; }
        public string PresentationRoom { get; set; }
        public bool IsNominatedBySupervisor { get; set; }
        public bool IsNominatedByExaminer1 { get; set; }
        public bool IsNominatedByExaminer2 { get; set; }
        public bool IsComplete { get; set; }
        public int PeriodId { get; set; }
        public DateTime? PresentationDateTime { get; set; }
        public DateTime? DemoDateTime { get; set; }
        //public string DemoRoom { get; set; }
        public string PosterTime { get; set; }
        public string PosterVenue { get; set; }

        public void FixMultilineFields()
        {
            if (!string.IsNullOrEmpty(Students))
                Students = Regex.Replace(Students, @"\r\n", "<br/>", RegexOptions.Multiline);

            if (!string.IsNullOrEmpty(Supervisors))
                Supervisors = Regex.Replace(Supervisors, @"\r\n", "<br/>", RegexOptions.Multiline);

            if (!string.IsNullOrEmpty(Examiners))
                Examiners = Regex.Replace(Examiners, @"\r\n", "<br/>", RegexOptions.Multiline);

            if (!string.IsNullOrEmpty(Abstract))
                Abstract = Regex.Replace(Abstract, @"\r\n", "<br/>", RegexOptions.Multiline);

            if (!string.IsNullOrEmpty(ProjectTasks))
                ProjectTasks = Regex.Replace(ProjectTasks, @"\r\n", "<br/>", RegexOptions.Multiline);
        }

        public IList<ProjectDocument> Documents
        {
            get
            {
                if (_ProjectDocuments == null)
                    _ProjectDocuments = DocumentRepository.GetProjectDocuments(ProjectID);
                return _ProjectDocuments;
            }
        }
    }
}
